//
//  CashbackRecordStore.m
//  NewPro
//
//  Created by 何荧红 on 2019/6/12.
//  Copyright © 2019 何荧红. All rights reserved.
//

#import "CashbackRecordStore.h"
#import "CashbackRecordModel.h"

@implementation CashbackRecordStore

//设置返现记录列表
- (void)GetListWithSign:(NSString *)sign AndCurrent:(NSInteger )current Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSDictionary *prams = @{
                            @"sign":sign,
                            @"current":[NSString stringWithFormat:@"%d",current],
                            @"size":@"100"
                            };
    NSString *url = [NSString stringWithFormat:@"%@/api/flow/reset/page",IP];
    [HttpTool getUrlWithString:url parameters:prams success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

//返现申请详情
- (void)GetDetailWithResetRecordId:(NSString *)resetRecordId Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/flow/reset/detail/%@",IP,resetRecordId];
    [HttpTool getUrlWithString:url parameters:@{} success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}

//同意或者拒绝请求
- (void)CancelOrSureWithResetRecordId:(NSString *)ResetRecordId AndType:(NSString *)type Success:(void(^)(NSDictionary *res))success Failure:(void(^)(NSError *error))failure{
    NSString *url = [NSString stringWithFormat:@"%@/api/flow/reset/%@/%@",IP,ResetRecordId,type];
    [HttpTool putUrlWithString:url parameters:@{} success:^(id responseObject) {
        NSError *erro = [HttpTool inspectError:responseObject];
        if (erro == nil) {
            success(responseObject);
        }else{
            failure(erro);
        }
    } failure:^(NSError *error) {
        failure(error);
    }];
}


@end
